package com.neuedu.dao.impl;

import java.util.List;
import java.util.Map;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.neuedu.dao.DeviceTypeDao;
import com.neuedu.model.DeviceType;

//把dao接口实现类，交给spring进行管理
@Repository
public class DeviceTypeDaoImpl implements DeviceTypeDao {

	//代码层级的整合spring+mybatis
	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;
	
	public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
		this.sqlSessionTemplate = sqlSessionTemplate;
	}
	
	@Override
	public int countDeviceType() {
		return sqlSessionTemplate.getMapper(DeviceTypeDao.class).countDeviceType();
	}

	@Override
	public List<DeviceType> findAll(Map<String, Object> map) {
		return sqlSessionTemplate.getMapper(DeviceTypeDao.class).findAll(map);
	}

	@Override
	public int addDeviceType(DeviceType u) {
		return sqlSessionTemplate.getMapper(DeviceTypeDao.class).addDeviceType(u);
	}

	@Override
	public int updateDeviceType(DeviceType u) {
		return  sqlSessionTemplate.getMapper(DeviceTypeDao.class).updateDeviceType(u);
	}

	@Override
	public int deleteDeviceType(int id) {
		return sqlSessionTemplate.getMapper(DeviceTypeDao.class).deleteDeviceType(id);
	}

	@Override
	public List<DeviceType> findList() {
		return sqlSessionTemplate.getMapper(DeviceTypeDao.class).findList();
	}

}
